package com.dao.predictableobject;

import java.util.HashMap;
import java.util.Iterator;

import org.apache.log4j.Logger;


/**
 * 
 * @author Mateusz Drzymala
 * 
 */
public class PredictableObject {
	
	private final static Logger LOGGER = Logger.getLogger(PredictableObject.class
			.getName());
	private int objId;
	private String objName;
	private String objType;
	private HashMap<Integer,Variable> variableMap;


	protected PredictableObject(){};
	protected PredictableObject(int objId, String objName,String type, HashMap<Integer,Variable> variableMap) {
		LOGGER.trace("constructor: PredictableObject("+objId+","+objName+","+variableMap+")");
		this.objId= objId;
		this.objName=objName;
		this.objType=type;
		this.variableMap=variableMap;
	}
/*	public void putVariable(int variableId, String variableName,
			String variableUnit, String variableDescritpion) {
		LOGGER.trace("method: putVariable("+ variableId+","+variableName+","
			+variableUnit+","+ variableDescritpion+")");
		Variable var = new Variable(variableId, variableName, variableUnit,
				variableDescritpion);
		variableMap.put(variableName, var);
	}*/
/*	public void removeVariable(String varName) {
		LOGGER.trace("method: removeVariable("+varName+")");
		variableMap.remove(varName);
	}*/
	public String getObjName() {
		LOGGER.trace("method: getObjName()");
		return objName;
	}
	public int getObjId() {
		LOGGER.trace("method: getObjId()");
		return objId;
	}
	public Variable getVariable(String name){
		LOGGER.trace("method: getVariable("+name+")");
		Iterator<Variable> iter =variableMap.values().iterator();
		while(iter.hasNext()){
			Variable var=iter.next();
			if(var.getVariableName().contentEquals(name))
				return var;
		}
		return null;
	}

	public String getObjType() {
		return objType;
	}
	public HashMap<Integer,Variable> getVariableMap() {
		LOGGER.trace("method: getVariableMap() ");
		return variableMap;
	}


}
